---
--类名: BountyTaskInfo.lua
--创建日期: 2018-3-14
--创建人: 陈小虎
--功能描述: 
--修改内容：
--修改日期:   
--修改人:     
--修改备注: 


local BountyTaskInfo = class("BountyTaskInfo")

function BountyTaskInfo:ctor()

end

function BountyTaskInfo:read(params)
	self.BountyTaskFinishNum = params.BountyTaskFinishNum
	self.bountyTaskRefresh = {}
	if params.bountyTaskRefresh then
		for i,v in ipairs(params.bountyTaskRefresh) do
			local BountyTaskRefresh = {District = v.District,RefreshNum = v.RefreshNum,Pos = v.Pos}
			if self.bountyTaskRefresh[v.District] == nil then
				self.bountyTaskRefresh[v.District] = {}
			end
			table.insert(self.bountyTaskRefresh[v.District],BountyTaskRefresh)
		end
	end
	self.BountyTaskMaxFinishNum = params.BountyTaskMaxFinishNum
end

function BountyTaskInfo:getFinishedNum()
	return self.BountyTaskFinishNum or 0
end

function BountyTaskInfo:getMaxNum()
	if not self.BountyTaskMaxFinishNum or self.BountyTaskMaxFinishNum <= 0 then
		self.BountyTaskMaxFinishNum = tonumber(S("wantedQuestLimit"))
	end
	return self.BountyTaskMaxFinishNum
end

function BountyTaskInfo:getTaskRefresh(district,pos)
	if self.bountyTaskRefresh and self.bountyTaskRefresh[district] then
		for i,v in ipairs(self.bountyTaskRefresh[district]) do
			if tonumber(v.Pos) == tonumber(pos) then
				return v
			end
		end
	end
	return nil
end


return BountyTaskInfo